"""
3.浏览器操作.py
1.maximize_window()  min
2.back()    后退
3,forward() 前进
4,refrush() 刷新
5. title 属性  获取页面标题
6. current_url  获取当前页面的url地址
7.get_screenshot_as_file()
8.close() 关闭窗口  quit() 退出浏览器
"""
from selenium import webdriver
from time import sleep

from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
# sleep(2)
# driver.minimize_window()
sleep(2)
driver.maximize_window()
sleep(2)
# driver.set_window_size(500,700)
# sleep(2)
# driver.maximize_window()
# sleep(2)
driver.get("http://www.baidu.com")
sleep(2)
driver.find_element(By.ID,"kw").send_keys("北京大风预警最新消息")
sleep(2)
driver.find_element(By.ID,"su").click()
sleep(2)
driver.back()
sleep(2)
driver.forward()
sleep(2)
driver.get_screenshot_as_file("aaaa.png")
print(driver.title)
print(driver.current_url)
driver.quit()